package com.source.lightfowl.person.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.stereotype.Component;

import javax.persistence.*;
import java.math.BigInteger;
import java.util.Date;

@Entity
@Data
//@Table(name = "person")
@Table(name = "sys_user")
@JsonIgnoreProperties({"hibernateLazyInitializer","handler"})
@AllArgsConstructor
@NoArgsConstructor
public class Person {

    /**
     * 整改为sys_user表
     */
    @Id
    @GenericGenerator(name = "sys-user-uuid", strategy = "uuid")
    @GeneratedValue(generator = "sys-user-uuid")
    private String id;//
    private String loginName;//登录名
    private byte[] password;//密码
    private String name;//姓名
    private String email;//邮箱
    private String phone;//phone
    private String mobile;//手机
    private String sex;//性别
    private String qq;
    private String wechat;
    private String wechatCode;
    private String wechatCodeDecode;//微信二维码解码
    private String idCard;//ID卡编号
    private String createBy;//创建者
    private String status;//在职状态

    //private String role;

    @Temporal(TemporalType.TIMESTAMP)
    @CreationTimestamp
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT-8")
    private java.util.Date createDate;//创建时间
    private String updateBy;//更新者
    private java.util.Date updateDate;//更新时间


    private String role;//所属角色的英文名（role.enname字段）

    public Person(String id, String loginName, byte[] password, String name, String email, String phone, String mobile, String sex, String qq, String wechat, String wechatCode, String wechatCodeDecode, String idCard) {
        this.id = id;
        this.loginName = loginName;
        this.password = password;
        this.name = name;
        this.email = email;
        this.phone = phone;
        this.mobile = mobile;
        this.sex = sex;
        this.qq = qq;
        this.wechat = wechat;
        this.wechatCode = wechatCode;
        this.wechatCodeDecode = wechatCodeDecode;
        this.idCard = idCard;

    }
/*原person字段
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private BigInteger personId;
    private String username;
    private byte[] password;
    private String email;
    private String name;//姓名
    private String phone;//电话
    private String rid;//角色id
    @Temporal(TemporalType.TIMESTAMP)
    @CreationTimestamp
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT-8")
    private Date registerTime;

 */
}
